package com.yyge.convertor;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yyge.controller.user.req.UserAddReq;
import com.yyge.controller.user.req.UserEditReq;
import com.yyge.controller.user.req.UserReq;
import com.yyge.controller.user.resp.UserResp;
import com.yyge.entity.User;
import com.yyge.vo.LoginUserVo;
import com.yyge.vo.PageVo;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @program: js-hd
 * @description: 用户对象装换器
 * @author: yyf
 * @create: 2024-02-01 09:51
 **/
@Mapper
public interface UserConvertor {
    UserConvertor MAPPER = Mappers.getMapper(UserConvertor.class);

    //Req -> Entity
    User ob2en(UserReq req);
    LoginUserVo en2vo(User user);

    //AddReq -> Entity
    User ob2en(UserAddReq req);

    //Edit -> Entity
    User ob2en(UserEditReq req);

    UserResp en2resp(User article);

    List<UserResp> ob2respArr(List<User> list);
    PageVo<UserResp> ob2respPage(Page<User> page);
}
